package com.changgou.goods.feign;

import com.changgou.common.vo.Result;
import com.changgou.goods.pojo.Goods;
import com.changgou.goods.pojo.Spu;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient("goods")
@RequestMapping("/spu")
public interface SpuFeign {

    /**
     * 根据商品spu id 查询商品（spu+sku列表）
     * @param spuId
     * @return
     */
    @GetMapping("/goods/{spuId}")
    Result<Goods> findGoodsBySpuId(@PathVariable("spuId") Long spuId);

    /***
     * 根据ID查询Spu数据
     * @param id 主键
     * @return 查询结果
     */
    @GetMapping("/{id}")
    public Result<Spu> findById(@PathVariable Long id);
}
